package com.practice.mybatis.v1;

import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;

public class Configuration {
	
	@SuppressWarnings("unchecked")
	public <T> T getMapper(Class<T> clazz, SqlSession sqlSession) {
		return (T) Proxy.newProxyInstance(this.getClass().getClassLoader(), 
				new Class[] {clazz}, new MapperProxy(sqlSession));
	}
	
	static class TestMapperXml {
		public static final String namespace = "com.practice.mybatis.v1.TestMapper";
		
		public static final Map<String, String> methoedSqlMapping = new HashMap<>();
		
		static {
			methoedSqlMapping.put("selectByPrimaryKey", "select * from test where id = '%d'");
		}
	}

}
